/**
 * @ClassName Demo10
 * @Description 方法重载练习
 * 练习一 比较两个数据是否相等
 * @Author Li
 * @Date 2022/7/31 10:06
 * @ModifyDate 2022/7/31 10:06
 * @Version 1.0
 */
public class Demo10 {
    public static void main(String[] args) {
        // 定义不同数据类型的变量
        byte a = 10;
        byte b = 20;
        short c = 30;
        short d = 30;
        int e = 40;
        int f = 50;
        long g = 60L;
        long h = 60L;
        // 调用
        System.out.println(compare(a, b));
        System.out.println(compare(c, d));
        System.out.println(compare(e, f));
        System.out.println(compare(g, h));
    }

    // 两个byte类型的
    public static boolean compare(byte a, byte b) {
        System.out.println("compare byte");
        return a == b;
    }

    // 两个short类型的
    public static boolean compare(short a, short b) {
        System.out.println("compare short");
        return a == b;
    }

    // 两个int类型的
    public static boolean compare(int a, int b) {
        System.out.println("compare int");
        return a == b;
    }

    // 两个long类型的
    public static boolean compare(long a, long b) {
        System.out.println("compare long");
        return a == b;
    }
}
